package com.itedge.solutionmanager.domain.dto;

import java.util.Locale;

import org.springframework.context.MessageSource;

import com.itedge.infrastructure.constants.InfrastructureConstants;
import com.itedge.solutionmanager.constants.SolutionManagerConstants;
import com.itedge.solutionmanager.domain.impl.Customer;

/**
 * Wrapper DTO (Data Transfer Object) around domain object 'Customer'
 */
public class CustomerDto {	
	
	private Long id;
	private String name;
	private String ico;
	private String dic;
	private String icdph;
	private String description;
	private String status;
	
	/**
	 * Constructor of Wrapper class
	 * 
	 * @param customer
	 * @param messageSource
	 * @param currentLocale
	 */
	public CustomerDto(Customer customer, MessageSource messageSource,  Locale currentLocale) {
		this.id = customer.getId();
		this.name = customer.getName();
		this.ico = customer.getIco();
		this.dic = customer.getDic();
		this.description = customer.getDescription();
		this.icdph = customer.getIcdph();
		if (messageSource != null) {
			this.status = messageSource.getMessage(customer.getStatus().toString(), null, 
					InfrastructureConstants.UNDEFINED_MESSAGE, currentLocale);
		} else {
			this.status = SolutionManagerConstants.UNDEFINED_MESSAGE_BUNDLE;
		}		
	}
	
	public String getName() {
		return name;
	}
	
	public String getIco() {
		return ico;
	}
	
	public String getDic() {
		return dic;
	}
	public String getDescription() {
		return description;
	}
	
	public String getIcdph() {
		return icdph;
	}
	
	public String getStatus() {
		return status;
	}
	
	public Long getId() {
		return id;
	}
}
